package com.Test;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class DistinctList {
    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();

        Collections.addAll(list, 1,1,2,2,2,3,3,1,1,2,2);
        System.out.println(list);

        int l=0;
        for (int i = 1; i < list.size(); i++) {
            if (list.get(l)==list.get(i)){
                list.remove(i);
                i--;
            }else {
                l++;
            }
        }
        System.out.println(list);
    }




    public static void delrepeat4(List<Integer> list){
        for(int i = 0; i < list.size() -1; i++){
            for(int j = list.size() - 1; j > i; j--){
                if(list.get(j).equals(list.get(i))){
                    list.remove(j);
                }
            }
        }
        System.out.println(list.toString());
    }


}
